import java.util.Scanner;

public class AddRev {
	public static void main(String args[]) {

		Scanner in = new Scanner(System.in);

		// Enter number of testcase
		int testcases = 0;
		if (in.hasNextInt()) {
			testcases = in.nextInt();
		}

		while (testcases != 0) {
			int firstNum = 0;
			int secondNum = 0;
			if (in.hasNextInt()) {
				firstNum = in.nextInt();
			}
			if (in.hasNextInt()) {
				secondNum = in.nextInt();
			}

			int reversedFirstNum = reverseInputNum(firstNum);
			int reversedSecondNum = reverseInputNum(secondNum);

			int sum = reversedFirstNum + reversedSecondNum;

			int reversedSum = reverseInputNum(sum);
			System.out.println(reversedSum);
			testcases--;
		}

	}

	// Reverse the input number
	private static int reverseInputNum(int number) {
		int reverseNum = 0;
		int multiply = 10;
		while (number > 0) {
			reverseNum = reverseNum * multiply;
			reverseNum = reverseNum + (number % 10);
			number = number / 10;
		}
		return reverseNum;

	}
}
